package tech.heiming.aps.scheduler.domain;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import tech.heiming.aps.scheduler.enums.ShiftType;

import java.time.DayOfWeek;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author heimingz
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Shift {
    private Map<DayOfWeek, ShiftType> dayOfWeeks;

    public Shift(List<ShiftType> shiftTypes) {
        this(DayOfWeek.MONDAY, shiftTypes);
    }

    public Shift(DayOfWeek startDay, List<ShiftType> shiftTypes) {
        dayOfWeeks = new HashMap<>();
        DayOfWeek dayOfWeek = startDay;
        for (ShiftType shiftType: shiftTypes) {
            dayOfWeeks.put(dayOfWeek, shiftType);
            dayOfWeek = dayOfWeek.plus(1);
        }
    }
}
